import AsyncValidator from 'async-validator';
import { validate } from 'sneakxy-validator';
//在不修改iview源码的前提下，校验框架async-validator替换为sneakxy-validator
AsyncValidator.prototype.validate = function(source, options, callback) {
    validate(source, this.rules, (valid, errors) => {
        callback(errors.length > 0 ? errors : null);
    }, {
        firstError: options.firstFields
    });
}

export default validate;